#
#   Flame.py
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; version 2 of the License.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   Copyright
#   Author: Nicholas F. Hoover
#   Contributors: 
#   Created: 2007.07.04
#   Last Modified: 2007.07.24
#

from GameObject import GameObject
from Animation import Animation

class Flame(GameObject):

##############
# ANIMATIONS #
##############

    NUM_ANIMATIONS = 1
    FLAME = 0

    LEFT = NUM_ANIMATIONS

    ###############
    # FRAME TICKS #
    ###############
    FLAME_FRAME_TICKS = 3

    ##############
    # KEY FRAMES #
    ##############
    FLAME_KEY_FRAME = Animation.ALL_KEY_FRAMES

    ###################
    # ANIMATION TABLE #
    ###################
    ANIMATION_TABLE = [
        (FLAME, 'Flame', FLAME_FRAME_TICKS, FLAME_KEY_FRAME, True),
        ]

    DEFAULT_ANIMATION = FLAME

###########
# ATTACKS #    
###########
    FLAME_DAMAGE = 150

########
# MISC #
########
    RECT_SIZE = (50,50)
    TICKS_TO_LIVE = 20

    
    def __init__(self):
        GameObject.__init__(self)
        self.ticksLeft = Flame.TICKS_TO_LIVE

    def update(self):
        self.ticksLeft -= 1
        if self.ticksLeft == 0:
            self.kill()
        else:
            GameObject.update(self)

    def flame(self):
        self.setAnimation(Flame.FLAME)


class Gas(GameObject):

##############
# ANIMATIONS #
##############

    NUM_ANIMATIONS = 1
    GAS = 0

    LEFT = NUM_ANIMATIONS

    ###############
    # FRAME TICKS #
    ###############
    GAS_FRAME_TICKS = 3

    ##############
    # KEY FRAMES #
    ##############
    GAS_KEY_FRAME = Animation.ALL_KEY_FRAMES

    ###################
    # ANIMATION TABLE #
    ###################
    ANIMATION_TABLE = [
        (GAS, 'Gas', GAS_FRAME_TICKS, GAS_KEY_FRAME),
        ]

    DEFAULT_ANIMATION = GAS

###########
# ATTACKS #    
###########
    GAS_DAMAGE = 150

########
# MISC #
########
    RECT_SIZE = (60,25)
    TICKS_TO_LIVE = 15

    
    def __init__(self):
        GameObject.__init__(self)
        self.ticksLeft = Gas.TICKS_TO_LIVE

    def update(self):
        self.ticksLeft -= 1
        if self.ticksLeft == 0:
            self.kill()
        else:
            GameObject.update(self)

    def gas(self):
        self.setAnimation(Gas.GAS)
